package com.kdg.passwordgenerator;

import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.Toolkit;

/**
 * Created with IntelliJ IDEA.
 * User: Adrynalyne
 * Date: 9/14/13
 * Time: 9:50 PM
 * To change this template use File | Settings | File Templates.
 */

class Misc {

    private boolean _letters = true;
    private boolean _numbers = true;
    private boolean _symbols = true;
    private int _limit = 7;
    private boolean tf;
    private String randomLetters;
    private String randomNumbers;
    private String randomSymbols;
    private String randomLettersSymbols;
    private String randomLettersNumbers;
    private String randomNumbersSymbols;
    private String randomAll;


    private final Generator gen = new Generator();
    
    public String GetLetters()  {
        return randomLetters;
    }

    public String GetNumbers() {
        return randomNumbers;
    }

    public String GetSymbols() {
        return randomSymbols;
    }
    
    public String GetRandomLettersSymbols(){
        return randomLettersSymbols;
    }
    
    public String GetRandomLettersNumbers(){
        return randomLettersNumbers;
    }
    
    public String GetRandomNumbersSymbols(){
        return randomNumbersSymbols;
    }
    
    public String GetRandomAll(){
        return randomAll;
    }

    public int GetLimit() {
        return _limit;
    }

    public void SetLimit (int limit) {
        this._limit = limit;
    }

    public void SetLetters(boolean letters) {
        this._letters = letters;
        this.randomLetters = gen.poolCharacters(GetLimit(), "l");
    }

    public void SetNumbers(boolean numbers) {
        this._numbers = numbers;
        this.randomNumbers = gen.poolCharacters(GetLimit(), "n");
    }

    public void SetSymbols(boolean symbols) {
        this._symbols = symbols;
        this.randomSymbols = gen.poolCharacters(GetLimit(), "s");
    }
    
    public void SetLettersSymbols(boolean tf1) {
        this.tf=tf1;
        if (tf)
            this.randomLettersSymbols = gen.poolCharacters(GetLimit(), "ls");
    }
    
    public void SetLettersNumbers(boolean tf1){
        this.tf=tf1;
        if(tf)
            this.randomLettersNumbers = gen.poolCharacters(GetLimit(), "ln");
    }
    
    public void SetNumbersSymbols(boolean tf1){
        this.tf=tf1;
        if(tf)
            this.randomNumbersSymbols = gen.poolCharacters(GetLimit(), "ns");
    }
    
    public void SetAll(boolean tf1){
        this.tf=tf1;
        if(tf)
            this.randomAll = gen.poolCharacters(GetLimit(), "all");
    }

    public void SetClip(String clip) {
        StringSelection stringSelection = new StringSelection(clip);
        Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
        clpbrd.setContents(stringSelection, null);
        
    }

}
